package cn.gson.crm.model.dao;

import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import cn.gson.crm.model.pojo.ConstactOrder;

@Repository
public interface ConstactOrderDAO extends CrudRepository<ConstactOrder, Long> {
	@Query("select c from ConstactOrder c order by c.id desc")
	public List<ConstactOrder> queryAllOrder(Pageable pageable);

	@Query("select c from ConstactOrder c where c.coTheme like ?1 order by c.id desc")
	public List<ConstactOrder> findcoTheme(String theme);
	
	@Query("select c from ConstactOrder c where c.coId = ?1")
	public ConstactOrder findById(long id);
	
	@Query("select max(c.coId) from ConstactOrder c")
	public Long getMaxId();
	
}
